import axios from "axios"
const baseUrl = "http://127.0.0.1:5000"
axios.defaults.withCredentials = true;
const commonApi = axios.create({
	baseURL:baseUrl,
	headers:{
		 Authorization: `Bearer ${sessionStorage.getItem('token')}`,
	}
})
//获取用户上传的壁纸列表
export const getuploadList =(id)=>{
	return commonApi({
		url:`/api/getuploadList?id=${id}`,
		method:'get'
	})
}

//首页推荐列表
export const getHomeList = (page)=>{
	return commonApi({
		url:`/api/getHomeList?page=${page}`,
		method:'get'
	})
}
//搜索
export const serachImg = (keyWork)=>{
	return commonApi({
		url:`/api/serachImg?keyWork=${keyWork}`,
		method:'get'
	})
}

//获取他人的头像以及主页背景
export const getOtherInfo = (userId)=>{
	return commonApi({
		url:`/api/getOtherInfo?userId=${userId}`,
		method:'get'
	})
}

//获取用户收藏列表
export const getCollections=(userId)=>{
	return commonApi({
		url:`/api/getCollections?userId=${userId}`,
		method:'get'
	})
}

//用户注册发送验证码到邮箱
export const sendMail = (email)=>{
	return commonApi({
		url:`/api/sendMail?email=${email}`,
		method:'get'
	})
}